package com.shujia.flink.sink

import org.apache.flink.streaming.api.functions.sink.PrintSinkFunction
import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment}

object Demo2Print {
  def main(args: Array[String]): Unit = {
    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment
    val linesDS: DataStream[String] = env.socketTextStream("master", 8888)

    /**
     * 打印结果，一般用于测试
     */
    //简介
    linesDS.print()

    val sinkFunction = new PrintSinkFunction[String]()
    linesDS.addSink(sinkFunction)
    

    env.execute()
  }

}
